<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title> Handling events in IE8 and earlier </title>
  <style>
	span {
		cursor: pointer;
	}
  </style>
  <script>
window.onload = function() {
	var div = document.getElementById("clickme");
	if (div.addEventListener) {
		div.addEventListener("click", handleClick, false);
	} else if (div.attachEvent) {
		div.attachEvent("click", handleClick);
	}
};

function handleClick(e) {
	var evt = e || window.event;
	var target;
	if (evt.target) {
		target = evt.target;
	} else {
		target = evt.srcElement;
	}
	alert("You clicked on " + target.id);
}

  </script>
</head>
<body>
<span id="clickme">Click me!</span>
</body>
</html>
